import { ref, onMounted } from 'vue';

export default () => {
	const height = ref('');
	const tabListRef = ref();
	onMounted(() => {
		if (tabListRef.value) {
			height.value = `${tabListRef.value?.height?.offsetHeight}px`;
		}
		// 监听浏览器高度变化从新计算高度
		window.onresize = () => {
			if (tabListRef.value) {
				height.value = `${tabListRef.value?.height?.offsetHeight}px`;
			}
		};
	});
	return {
		height,
		tabListRef
	};
};
